package com.nowcoder.community.config;

import com.nowcoder.community.property.WkProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;


@Configuration
@Slf4j
public class WkConfig {

    @Autowired
    private WkProperty wkProperty;

    /**
     * 创建存储长图的目录
     * */
    @PostConstruct
    public void init() throws IOException {
        Files.createDirectories(Paths.get(wkProperty.getStorage()));
        log.info("创建长图存储目录：" + wkProperty.getStorage());
    }
}
